const app = getApp()



Page({

  /**
   * 页面的初始数据
   */
  data: {
    CustomBar: 0,
    statusBar: 0,
    showcollapse: false,
    collapse: false,
    steps: [{
        text: '2020.11.22',
        desc: '开始报名',
      },
      {
        text: '2020.11.22',
        desc: '截止报名',
      },
      {
        text: '2020.11.22',
        desc: '工作时间',
      },
      {
        text: '2020.11.22',
        desc: '工作结束',
      },
    ],
    latitude: 23.095994,
    longitude: 113.325520,
    markers: [{
      id: 4,
      latitude: 23.095994,
      longitude: 113.325520,
      width: 28,
      height: 32,
      iconPath: '../../resources/w-dz.png',
      customCallout: {
        anchorY: 0,
        anchorX: 20,
        display: 'ALWAYS',
      },
    }],
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let CustomBar = app.globalData.CustomBar;
    let statusBar = app.globalData.statusBar
    this.setData({
      CustomBar: CustomBar - statusBar,
      statusBar: statusBar,
    })
    var that = this;
    wx.getSystemInfo({
      success: (result) => {
        var spx = 280 / 750 * result.windowWidth;
        that.setData({
          sh: result.windowHeight - CustomBar,
          shs: result.windowHeight - CustomBar - spx,
        })
      },
    })
  },
  oncliclCall: function () {
    wx.makePhoneCall({
      phoneNumber: '17319743876' //仅为示例，并非真实的电话号码
    })
  },
  onclickBack: function () {
    wx.navigateBack({
      delta: 1,
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    this.setCollapse()

  },
  //判断全文收起是否展示
  setCollapse: function () {
    var query = wx.createSelectorQuery();
    var that = this;
    query.selectAll('#co').boundingClientRect(function (rect) {
      console.log("------2222---", rect);
      rect.forEach((v, i) => {
        if (v.height > 60) { //判断高度,根据各种高度取折中
          that.setData({
            collapse: true,
            showcollapse: true
          })
        }
      })
    }).exec();
  },
  //点击全文收起
  changeCollapse: function () {
    this.setData({
      collapse: !this.data.collapse
    })
  },
  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
    var shareObj = {
      title: "分享岗位", // 默认是小程序的名称(可以写slogan等)
      path: getApp().globalData.userInfo.inviteCode?'/pages/index/index?code='+getApp().globalData.userInfo.inviteCode:'/pages/index/index', // 
      imageUrl: '',
      success: function (res) {
        // 转发成功之后的回调
        if (res.errMsg == 'shareAppMessage:ok') {
        }
      }
    }
    console.log("------------", shareObj);
    // 返回shareObj
    return shareObj;
  }
})